package com.pug.service.banner;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pug.pojo.Banner;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * Author: lqm
 * create: 2022/5/15 10:08
 * Lover: lqx
 *
 * @see
 */
@Service
public class BannerServiceImplPool implements Callable<List<Banner>> {
    int curren=1;
    int size=6;
//    public BannerServiceImplPool(int current,int size){
//        this.curren=current;
//        this.size=size;
//    }
    @Resource
    BannerServiceImpl bannerService;
    @Override
    public List<Banner> call() throws Exception {
        Page<Banner> page=new Page(curren,size);
        QueryWrapper<Banner> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("status",1);
        queryWrapper.orderByAsc("sorted");
        Page<Banner> page1 = bannerService.page(page, queryWrapper);
        List<Banner> records = page1.getRecords();
        return records;
    }
}
